<form action="shopcategory.manage.php" id="form1" name="form1" method="post" onsubmit="return ajax_sort();">
<input type="hidden" name="action" value="sort" />
<table width="680px" border="0" cellspacing="0" cellpadding="0" class="area_ajax_list" >
	<tr class="area_ajax_list_title" >
		<td width="25%" height="34" align="center"><strong><tpl> $langCSort </tpl></strong></td>
		<td width="30%" height="34"><strong><tpl> $langShopClassName </tpl></strong></td>
		<td width="30%" height="34"><strong><tpl> $langSysCOperate </tpl></strong></td>
		<td width="15%" height="34">	
		<span class="btn_left"><strong><input class="btn_submit" name="submit" type="submit" value="<tpl> $langShopSubmitSort </tpl>"/></strong></span>
		</td>
	</tr>
<tpl> if $shop_category_tree[0].class_id neq ''</tpl>
  <tpl> section name=listclass loop=$shop_category_tree </tpl>
  <tr class="area_ajax_list_title_main" onmouseout="this.style.backgroundColor='#fff'" onmouseover="this.style.backgroundColor='#E6F5FE'">
		<td height="30" align="center" valign="middle"><input name="class_sort[]"  style="border:1px solid #ccc" type="text" value="<tpl> $shop_category_tree[listclass].class_sort </tpl>" size="5" maxlength="5" /></td>
		<td width="30%" height="30" align="left" valign="middle">
			<tpl> $shop_category_tree[listclass].class_name </tpl>
			<!--  判断是否隐藏  -->
			  <tpl> if $shop_category_tree[listclass][2] eq '0' </tpl>
				<a href="javascript:;" onclick="ajax_modi('<tpl> $shop_category_tree[listclass].class_id </tpl>')"><font color="#FF0000">[<tpl> $shop_category_tree[listclass].class_state </tpl>]</font></a>
			  <tpl> /if </tpl>
		</td>
		<td width="30%" height="30" align="left" valign="middle">		
			<a href="javascript:;" onclick="ajax_modi('<tpl> $shop_category_tree[listclass].class_id </tpl>')" title="<tpl> $langCmodi </tpl>" class="modify_a_pic"></a> 
			<a href="javascript:;" onclick="ui_del('<tpl> $shop_category_tree[listclass].class_id </tpl>');" title="<tpl> $langCdele </tpl>" class="del_a_pic"></a> 
			<input name="id[]" type="hidden" value="<tpl> $shop_category_tree[listclass].class_id </tpl>" />
		</td>
		<td height="30" align="left" valign="middle">&nbsp;</td>
	</tr>
  
  <tpl> /section </tpl>
  <tr class="area_ajax_list_title" >
		<td width="25%" height="34" align="center"></td>
		<td width="30%" height="34"></td>
		<td width="30%" height="34"></td>
		<td width="15%" height="34">	
			<span class="btn_left"><strong><input class="btn_submit" name="submit" type="submit" value="<tpl> $langShopSubmitSort </tpl>"/></strong></span>
		</td>
	</tr>
<tpl> else  </tpl>
<tr class="area_ajax_list_title_main">
		<td height="30" colspan="4" align="center"><tpl> $langCNull  </tpl></td>
	</tr>
<tpl> /if  </tpl>
</table>
</form>
  
<div id="ui_question" style="display:none; cursor: default; padding:10px"> 
        <b style=" font-size:14px; margin-top:10px; line-height:50px; height:50px;padding-top:10px; padding-bottom:10px"><tpl> $langCConfirmDelete </tpl></b> <br />
        <input type="button" id="yes" value="<tpl> $langCYes </tpl>"  style=" border:1px solid #CCCCCC;width:80px; margin:5px; background-image:url(../templates/system_new/images/anniu.gif)"/> 
        <input type="button" id="no" value="<tpl> $langCNo </tpl>"  style="border:1px solid #CCCCCC;width:80px; margin:5px; background-image:url(../templates/system_new/images/anniu.gif)"/>
		<input type="hidden" id="del_value" />
</div>   
<script>
var ui_question = $("#ui_question")[0];
//删除
function ui_del(str){
	hideMessage();
	$.blockUI(ui_question, { width: '275px' }); 
	$('#del_value').val(str);
}
$(function() {
	$('#yes').click(function() {
		$.ajax({
			url: "shopcategory.manage.php",
			data: 'action=del&classid='+$('#del_value').val(),
			type:'post',
			dataType:"json",
			beforeSubmit:  showLoading(showText),
			success: function(msg){
				hideLoading();
				showMessage(msg.message,msg.type);
				if(msg.type == 1){
					ShowDiv	= 'result_content';
					getPageContent("shopcategory.manage.php?action=ajax_list");
				}
				$.unblockUI(); 
			}
		});
		return false; 
	}); 
	$('#no').click($.unblockUI); 
}); 
 
//提交排序
function ajax_sort(){
	
	var queryString=$("#form1").formSerialize();

	$.ajax({
		url: "shopcategory.manage.php",
		data: queryString,
		type:'post',
		dataType:"json",
		beforeSubmit:  showLoading(showSaveText),
		success: function(msg){
					hideLoading();
					showMessage(msg.message,msg.type);
					if(msg.type == '1'){
						ShowDiv	= 'result_content';
						getPageContent("shopcategory.manage.php?action=ajax_list");
					}
		}
	});
	return false;
}

//修改
function ajax_modi(id){
	ShowDiv = 'result_content';
	getPageContent('shopcategory.manage.php?action=modi&classid='+id);
}

//删除
function ajax_del(id){
	$.ajax({
		url: "shopcategory.manage.php",
		data: 'action=del&classid='+id,
		type:'post',
		dataType:"json",
		beforeSubmit:  showLoading(showSaveText),
		success: function(msg){
					hideLoading();
					showMessage(msg.message,msg.type);
					if(msg.type == '1'){
						ShowDiv	= 'result_content';
						getPageContent("shopcategory.manage.php?action=ajax_list");
					}
		}
	});
}

//合并
function ajax_merger(str){
	hideMessage();
	ShowDiv	= 'result_content';
	getPageContent("shopcategory.manage.php?action=merger_class&class_id="+str);
}

</script>
